﻿@model List<string>
<div class="select2-blue">
    <select asp-for="@Model" asp-items="@((IEnumerable<SelectListItem>)ViewData["SelectList"])" multiple="multiple" class="form-control select2" style="width: 100%;" data-dropdown-css-class="select2-blue"></select>
</div>
<script>
    $(function() {
        $("#@Html.IdForModel()").select2({
            tags: true,
            createTag: function(params) {
                var term = $.trim(params.term);

                if (term === '') {
                    return null;
                }

                return {
                    id: term,
                    text: term,
                    newTag: true
                }
            }
        })
    });
</script>